package com.gable.exhibition.thread;

import com.gable.exhibition.util.HttpHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by mj on 2018/1/30.
 * 流程创建群组
 */
public class ChatGroupThread implements Runnable{

    Logger log = LoggerFactory.getLogger(ChatGroupThread.class);
    private String fromId;

    private String webSocket_InsertUrl;

    public ChatGroupThread(String fromId,String webSocket_InsertUrl){
        this.fromId = fromId;
        this.webSocket_InsertUrl = webSocket_InsertUrl;
    }

    @Override
    public void run() {
        String result = "";
        try {
            Thread.sleep(2000L);
            if(fromId != null){
                Map<String,String> map = new HashMap<String,String>();
                map.put("fromId",fromId);
                result = HttpHelper.postRequestResponseBodyAsString(webSocket_InsertUrl, map);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        log.info(result);
    }
}
